@extends('admin.public.father')
@section('content')
        <div class="card">
            <table class="table table-hover" style="text-align: center">
                <thead>
                    <tr>
                        <th scope="col">编号</th>
                        <th scope="col">昵称</th>
                        <th scope="col">邮箱</th>
                        <th scope="col" width="200">操作</th>
                    </tr>
                </thead>
                <tbody>
                @foreach($users as $v)
                <tr>
                    <th scope="row">{{$v['id']}}</th>
                    <td>{{$v['username']}}</td>
                    <td>{{$v['email']}}</td>
                    <td>
                        <div class="btn-group">
                            {{--路由参数调用到页面中--}}
                            @can('update',$v)
                                <a href="{{route('user.edit',['id'=>$v['id']])}}" class="btn btn-success">编辑</a>
                            @endcan
                            @can('delete',$v)
                                <form action="{{route('user.destroy',['id'=>$v['id']])}}" method="post">
                                    @csrf
                                    @method('DELETE')
                                    {{--由于删除操作需要detele请求方式，所以将删除按钮包裹在from表单内--}}
                                    <button type="submit" class="btn btn-danger">删除</button>
                                </form>
                            @endcan
                        </div>
                    </td>
                </tr>
                @endforeach
                </tbody>
            </table>
        </div>
        <div class="container">
            <div class="row justify-content-md-center">
                <div class="col-md-auto">
                    {{--分页显示内容--}}
                    {{ $users->links() }}
                </div>
            </div>
        </div>

@endsection